import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import Hi from '@/components/Hi'
import Hi1 from '@/components/Hi1'
import Hi2 from '@/components/Hi2'
import Rh1 from '@/components/Rh1'
import Rh2 from '@/components/Rh2'
import Param from '@/components/Param'
import route2 from '@/route2'
Vue.use(Router)

export default new Router({
  // mode:'history',
  mode:'hash',
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component:HelloWorld,
      alias:'/home'
    },
    {
      path: '/param/:id',
      name: 'param',
      component:Param
    },
    {
      path: '/route2',
      name: 'route2',
      component: route2,
      children: [{
        path: "/route2/rh1",
        components: {
          default: Rh1,
          view1:Rh2,
          view2:Rh2
        },
      }],
      beforeEnter: (to, from, next) => {
        // ...
        next()
      }
    },
    {
      path: '/hi',
      name: 'Hi',
      component: Hi,
      children:[
        {path:'/hi/hi1',name: 'hi1',component:Hi1},
        {path:'/hi/hi2',name: 'hi2',component:Hi2}
      ]
    },{
      path:'*',
      component:{ template: '<div>404</div>' }
    }
  ]
})
